home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
C and C++
/
Graphics⁄Sound
/
Macintosh Tracker Folder
/
Trecker Server Folder
/
STrI.h
< prev
Wrap
Text File
|
1992-04-23
|
4KB
|
111 lines
/* SoundTracker.h - Header for 'STrI' resource */
/* Copyright © 1991 by Frank Seide, Koolbarg 39d, D-2000 Hamburg 74, Germany */
#ifndef __SOUNDTRACKER__
#define __SOUNDTRACKER__
/***** Constants: *****/
#define VBLFRAMES 445 /* Number of Frames per 20ms */
#define CHANNELS 4 /* Number of voices */
/***** Structures: *****/
#define FASTFORWARD 2
#define FASTERFORWARD 4
struct MusicRecord {
Byte fastForward; /* Fast forward: speed factor */
Byte ffCounter;
unsigned int VBLFrames;
Byte speed;
Byte songPos;
int pattPos;
Byte counter;
Boolean pattBreak;
Boolean loopDetect; /* Detect loops in SoundTracks ? */
Boolean looping;
Boolean endOfPiece; /* TRUE => SoundTrack finished (e.g. no fade out) */
Boolean nextOne; /* TRUE => Play next SoundTrack */
int speedFactor; /* Speed adjust factor in percent (default 100%) */
long playingTime; /* Playing time in 1/50 seconds */
char reserved[CHANNELS*0x30];
};
/* Main data structure; it describes one complete SoundTrack in memory and */
/* contains all flags and internal variables to interpret the SoundTrack. */
struct SoundTrack {
struct PChannel * playRecord; /* PChannel to which the STrk is linked */
char signature[21]; /* SoundTrack name as stored in the file */
Byte ldOverSampling;
Boolean check;
Byte paddedInstruments; /* Number of instruments not correctly loaded */
struct MusicRecord musicRecord; /* Flags and workspace for STrk interpreter */
Byte numPointers;
Byte numInstruments;
int numPatterns;
long ** pointers;
Handle patterns;
long paddedBytes; /* Number of bytes missing in file */
/* some more private data follows here. */
};
/***** Error code: *****/
#define errBadFormat badMDBErr /* GetSoundTrack(): No SoundTrack-File */
/***** Function prototypes: *****/
extern pascal OSErr GetSoundTrack (int vRefNum, StringPtr fName, int ldOverSampling,
struct SoundTrack ** *soundTrackHandle, Boolean check);
extern pascal void DisposeSoundTrack (struct SoundTrack ** sth);
extern pascal struct SoundTrack * LockSoundTrack (struct SoundTrack ** soundTrack);
extern pascal void UnlockSoundTrack (struct SoundTrack ** soundTrack);
extern pascal void UnlinkSoundTrack (struct SoundTrack ** soundTrack);
extern pascal void LinkSoundTrack (struct SoundTrack ** soundTrack, struct PChannel * pc);
extern pascal void UpdateSoundTrack (struct SoundTrack ** soundTrack);
extern pascal int VersionSoundTrack();
/***** Specification of the SoundTrack- (.mod)-Format: *****/
#define SOUNDCHANNELS 4 /* Number of voices */
struct Command { /* One play command in a pattern */
int InstrHiNibble : 4; /* Instrument number (Hi-Nibble) */
int AmigaPeriod : 12; /* Pitch (Samp. freq. = 3.579545 MHz / AmigaPeriod) */
int InstrLoNibble : 4; /* Instrument number (Lo-Nibble) */
int EffectCmd : 4; /* Effects: command */
int EffectArg : 8; /* and operand */
};
struct Pattern { /* Pattern = 64 notes to play (each on 4 channels) */
struct Command Commands[64][SOUNDCHANNELS];
};
struct FileInstrData { /* One instrument descriptor */
char Filename[22]; /* Amiga filename */
unsigned int numWords; /* Sample length in words (!) */
int volume; /* Volume (0..64) */
unsigned int loopWord; /* Loop start offset (in words) */
unsigned int loopWords; /* Loop length (in words) */
};
#define MAXPTRS 128 /* Size of pointer table */
#define MAXPTRNS MAXPTRS /* Maximum number of patterns */
struct SoundTrackSpec { /* Pseudo data structure to describe file contents: */
char NameSignature[20]; /* SoundTrack name (not necessarily file name) */
struct FileInstrData fid[31]; /* 31 or 15 instrument descriptors */
Byte numPointers; /* 0x3b6 / 0x1d6 Max. pointer value to use (+1) */
Byte maxPointers; /* 0x3b7 / 0x1d7 Useless value */
Byte oPointers[MAXPTRS]; /* 0x3b8 / 0x1d8 Patterns numbers */
long longFmtSignature; /* 0x438 / - ('M.K.' or 'FLT4') */
struct Pattern patterns[]; /* 0x43c / 0x258 Pattern data */
/* Sample0[]; /* Sample data of 31 / 15 instruments */
};
#endif